$(document).ready(function(){
    $(".i-checks").iCheck({
        checkboxClass:"icheckbox_square-green",
        radioClass:"iradio_square-green",
    });

    //判断内容是否为空
    $("#save").click(function(){
        var commission = $.trim($("input[name='commission']").val());
        var vip = $.trim($("input[name='vip']").val());
        var first = $.trim($("input[name='first']").val());
        var second = $.trim($("input[name='second']").val());
        var firstnum = $.trim($("input[name='firstnum']").val());
        var secondnum = $.trim($("input[name='secondnum']").val());

        if(commission == ''){
            layer.msg('请填写返佣信息');
            return false;
        }

        if(vip == ''){
            layer.msg('请填写vip价格信息');
            return false;
        }

        if(first == ''){
            layer.msg('请填写天使价格信息');
            return false;
        }

        if(second == ''){
            layer.msg('请填写梦想价格信息');
            return false;
        }

        if(firstnum == ''){
            layer.msg('请填写天使名额信息');
            return false;
        }

        if(secondnum == ''){
            layer.msg('请填写梦想名额信息');
            return false;
        }

        //ajax异步提交数据
        $.ajax({
            url: GV.system_siteconfig,
            type:'post',
            data: {'commission':commission,'vip':vip,'first':first,'second':second,'firstnum':firstnum,'secondnum':secondnum},
            success:function(data){
                if(data.status == 1){
                    layer.msg(data.info);
                    setTimeout(function(){
                        location.href = data.url;
                    },1000);
                }else{
                    layer.msg(data.info);
                    location.href = data.url;
                }
            }
        });
    });
});